klcs.dictArray = {};// 初始化,防止异步报错
klcs.dictObject = {};

// 将 {aaa: {0: "正常",1:"不正常"}} 转化为 {aaa:[{"value": "0","label": "正常"}]} 
klcs.createDictObjectType = function (dict) {
  const obj1 = {}
  for (let key in dict) {
    let obj = dict[key]
    let arr = []
    for (let k in obj) {
      arr.push({ value: k, label: obj[k] })
    }
    obj1[key] = arr
  }

  return obj1;
}

klcs.getStatusColor = function (status) {
  if (status == 0) {
    return '#B1DC58'
  }
  if (status == 1) {
    return "red"
  }
  if (status == 2) {
    return 'rgb(150, 151, 153)'
  }

  return 'rgb(150, 151, 153)'
};

// 模拟异步
setTimeout(() => {
// 原模式
const dict = {aaa: {0: "正常",1:"不正常"}} ;
// 下拉框用
klcs.dictArray = klcs.createDictObjectType();

// 翻译字典用
klcs.dictObject = dict
})